Add fuzzy matching for Enum member access errors#20694
Draft
KevinRK29 wants to merge 7 commits intopython:masterfrom
Draft
Add fuzzy matching for Enum member access errors#20694KevinRK29 wants to merge 7 commits intopython:masterfrom
KevinRK29 wants to merge 7 commits intopython:masterfrom
Conversation
for more information, see https://pre-commit.ci
This comment has been minimized.
This comment has been minimized.
KevinRK29
commented
Jan 30, 2026
|
|
||
| Color.GREN # E: "type[Color]" has no attribute "GREN"; maybe "GREEN"? | ||
| Color.YELOW # E: "type[Color]" has no attribute "YELOW"; maybe "YELLOW"? | ||
| Color.RDE # E: "type[Color]" has no attribute "RDE" |
Collaborator
Author
There was a problem hiding this comment.
This doesn't trigger fuzzy matching due to it being below the 0.75 threshold in best_matches
for more information, see https://pre-commit.ci
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/flow_engine.py:1703: error: "R" has no attribute "__anext__" [attr-defined]
+ src/prefect/flow_engine.py:1703: error: "R" has no attribute "__anext__"; maybe "__ne__"? [attr-defined]
- src/prefect/task_engine.py:1794: error: "R" has no attribute "__anext__" [attr-defined]
+ src/prefect/task_engine.py:1794: error: "R" has no attribute "__anext__"; maybe "__ne__"? [attr-defined]
colour (https://github.com/colour-science/colour)
- colour/utilities/network.py:154: error: "Self" has no attribute "_id" [attr-defined]
+ colour/utilities/network.py:154: error: "Self" has no attribute "_id"; maybe "id"? [attr-defined]
zulip (https://github.com/zulip/zulip)
+ zerver/models/push_notifications.py:73: error: "type[TokenKind]" has no attribute "choices" [attr-defined]
+ zerver/models/push_notifications.py:114: error: "type[ErrorCode]" has no attribute "choices" [attr-defined]
+ zerver/models/messages.py:53: error: "type[MessageType]" has no attribute "choices" [attr-defined]
+ zerver/models/user_topics.py:44: error: "type[VisibilityPolicy]" has no attribute "choices" [attr-defined]
ibis (https://github.com/ibis-project/ibis)
- ibis/backends/__init__.py:1275: error: "None" has no attribute "__iter__" (not iterable) [attr-defined]
+ ibis/backends/__init__.py:1275: error: "None" has no attribute "__iter__"; maybe "__dir__" or "__str__"? (not iterable) [attr-defined]
- ibis/backends/clickhouse/__init__.py:253: error: "None" has no attribute "__iter__" (not iterable) [attr-defined]
+ ibis/backends/clickhouse/__init__.py:253: error: "None" has no attribute "__iter__"; maybe "__dir__" or "__str__"? (not iterable) [attr-defined]
apprise (https://github.com/caronc/apprise)
- apprise/persistent_store.py:1324: error: "None" has no attribute "__iter__" (not iterable) [attr-defined]
+ apprise/persistent_store.py:1324: error: "None" has no attribute "__iter__"; maybe "__dir__" or "__str__"? (not iterable) [attr-defined]
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds fuzzy matching suggestions when accessing invalid enum members, similar to the existing behavior for module imports and instance attributes.